home *** CD-ROM | disk | FTP | other *** search
- In an earlier posting, I noted that GNU tar 1.10 will core dump
- if long filenames (length greater than NAMSIZ) are encountered in
- multi-volume mode. In this posting the error is described and a patch given.
-
- The essence of the problem is that the pointer save_name, which is set
- in function dump_file() of module create.c, points to the original
- long filename instead of the new, shorter mangled name that is set in
- start_header() of module create.c. The pointer save_name is only used
- in multi-volume mode when the file being processed is non-sparse; if a
- file is split between volumes, the save_name is used in generating
- the LF_MULTIVOL record on the second volume. In the original code, the
- core dump was due to strcpy() writing a string longer than NAMSIZ
- to string real_s_name in fl_write() of module buffer.c; this error
- will not happen with the patch to create.c since the mangled names
- are shorter than NAMSIZ.
-
- Only the patch to create.c is really necessary. The patch to buffer.c
- was what I first put in to stop tar from core dumping. I have tested
- this code with long filenames where the file in question is split
- between volumes. The files are recovered and renamed properly.
- I have *not* tested the code to see if the patch for long directory
- names works properly.
-
- -pierce
- --
- Pierce Cantrell cantrell@ee.tamu.edu
- Dept. of Elec. Eng.
- Texas A&M University
-
-
-
- cantrell# diff create.c.orig create.c
- 158a159,163
- > /* handle multivolume mangled properly PEC 7-29-91 */
- > static int mange;
- > char mange_name[NAMSIZ];
- > /* end PEC 7-29-91*/
- >
- 531c536,541
- < save_name = p;
- ---
- > /* PEC 7-29-91 */
- > if(mange)
- > save_name = mange_name;
- > else
- > save_name = p;
- > /* end PEC 7-29-91 */
- 689c699,704
- < save_name=p;
- ---
- > /* PEC 7-29-91 */
- > if(mange)
- > save_name = mange_name;
- > else
- > save_name=p;
- > /* end PEC 7-29-91 */
- 1160a1176,1178
- > /* PEC 7-29-91 */
- > mange = 0;
- > /* end PEC 7-29-91 */
- 1166a1185,1188
- > /* PEC 7-29-91 */
- > mange = 1;
- > strncpy(mange_name, header->header.name, NAMSIZ);
- > /* end PEC 7-29-91 */
-
-
- cantrell# diff buffer.c.orig buffer.c
- 693c693,695
- < strcpy(real_s_name,save_name);
- ---
- > /* strcpy(real_s_name,save_name); */
- > strncpy(real_s_name,save_name,NAMSIZ-1);
- > real_s_name[NAMSIZ]='\0';
-
-